package com.t17;

 import net.mindview.util.Pair;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.Map;

/**
 * Created by xuyiwei on 2018/8/13.
 */
public class MapData<K,V> extends LinkedHashMap<K,V> {
    public MapData(Generator<Pair<K,V>> gen,int quantity){
        for(int i=0;i<quantity;i++){
            Pair<K,V> p = gen.next();
            put(p.key,p.value);
        }
    }
    public MapData(Generator<K> genK,Generator<V> genV,int quantity){
        for(int i=0;i<quantity;i++){
            put(genK.next(),genV.next());
        }
    }
    public MapData(Generator<K> genK,V value,int quantity){
        for(int i=0;i<quantity;i++){
            put(genK.next(),value);
        }
    }
    public MapData(Iterable<K> genK,Generator<V> genV){
        for(K key:genK){
            put(key,genV.next());
        }
    }
    public MapData(Iterable<K> genK,V value){
        for(K key:genK){
            put(key,value);
        }
    }
}
